UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O9xyIHy5IU1wFCErDxjKADruhXebcdt50JZQoO/csho=' 
WHERE 
  key_id = 'cfac58ad05cdd796c0850bcfbae0daf75bfdbc68cf852ae79eaf611ac3df6fbb' 
  AND (
    token = 'O9xyIHy5IU1wFCErDxjKADruhXebcdt50JZQoO/csho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036