UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pmgkIMfL6QZATPNAH+HNbZoKa19W6wl4OTrs2n0hrno=' 
WHERE 
  key_id = '3ee82418dd91c45397a18e36a17cf08854bb3f4131c2ba309ae23921ecec8791' 
  AND (
    token = 'pmgkIMfL6QZATPNAH+HNbZoKa19W6wl4OTrs2n0hrno=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028