UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oyQPtxaadej3v8Dbebmgahkl3Op6e95VdHWPoHQr1zA=' 
WHERE 
  key_id = '7f72c02cd17aa981a8cc550dd5ab77ec674ab980173b74230bb34f877aa42c23' 
  AND (
    token = 'oyQPtxaadej3v8Dbebmgahkl3Op6e95VdHWPoHQr1zA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029