UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G1bNucv13K0fMucX28qopimhLPMuV3XZSBI+Hq/4l7g=' 
WHERE 
  key_id = '58681ff836953c34a61cacb3f09e7a1d2af689db6b6c2b0aa2b828511a29831e' 
  AND (
    token = 'G1bNucv13K0fMucX28qopimhLPMuV3XZSBI+Hq/4l7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037