UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WJVDNCmLmVOOTkpzAogMfcZDMclSaw36lFZ4STXAWxQ=' 
WHERE 
  key_id = 'f51c60c3f5bed7867b5b47edbb20260acb1776d047e4e7c48126250178a40ab8' 
  AND (
    token = 'WJVDNCmLmVOOTkpzAogMfcZDMclSaw36lFZ4STXAWxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031