UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5L+MCXcTU101o9IuUmisiEUXqwoEqAUFRTew2n3unSI=' 
WHERE 
  key_id = '151dc9b61b460b3743223d48969bd16b6d77d53e53e929dbf5ef65416d7af380' 
  AND (
    token = '5L+MCXcTU101o9IuUmisiEUXqwoEqAUFRTew2n3unSI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036