UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eMe82SFYWd9loCxkTq32wBL2ZhpFZs5d1+NrjjCdeTk=' 
WHERE 
  key_id = '48a9bb96d9e83f3c80264a1e92f5cd34359d9578362535eab688aa8654cab4bd' 
  AND (
    token = 'eMe82SFYWd9loCxkTq32wBL2ZhpFZs5d1+NrjjCdeTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025