UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KHbzPEyQ4q2jAUS8m3m6Zle1t0e4pS7Vw71p2zqLzMs=' 
WHERE 
  key_id = '65f95abdb2e5c5f60a6470c2c3922994fc344d9593d35dc4ffeb829850bb3b74' 
  AND (
    token = 'KHbzPEyQ4q2jAUS8m3m6Zle1t0e4pS7Vw71p2zqLzMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035