UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J9JtfbN09DkbXdsYVdU1Y4oXvjz4RKe2MF5hCIh1rrI=' 
WHERE 
  key_id = '477a540c042702569180c753e2e769d98de3e871741cfb1133f4dca8e92c1b12' 
  AND (
    token = 'J9JtfbN09DkbXdsYVdU1Y4oXvjz4RKe2MF5hCIh1rrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042