UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8sNLRJbO7m/0831XtSX21T+eHVKRpjeuVZ6atqp1ocA=' 
WHERE 
  key_id = 'b14019b9783f2bf812729a79d4b0351274140a3d89a073de1a081fedc048c47d' 
  AND (
    token = '8sNLRJbO7m/0831XtSX21T+eHVKRpjeuVZ6atqp1ocA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025