UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l9OFed6//GdRih9OYgPGVKJoD5Ovgo6kNlimHEcSLv4=' 
WHERE 
  key_id = '419ad150e96c25344fdea8c18e3f3a2dc490be65cd49a757a0850ac1393b4c4f' 
  AND (
    token = 'l9OFed6//GdRih9OYgPGVKJoD5Ovgo6kNlimHEcSLv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040