UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tFq5RqzPTOfAiltjEHUoW/pqTlX3z5NW7QWO1N6grBI=' 
WHERE 
  key_id = '7792fbb265a822317950b46f965934be1f85a38beb4e7ec5f4017d07643aedf8' 
  AND (
    token = 'tFq5RqzPTOfAiltjEHUoW/pqTlX3z5NW7QWO1N6grBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018