UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TEi6CTk8JMOanz+FX5aa4prdy+kWyycdxLde3JFWLrk=' 
WHERE 
  key_id = 'bbdc538d883027ecf0389cafb55c73d246b9c7671558bd73d6437b2d509dc3d0' 
  AND (
    token = 'TEi6CTk8JMOanz+FX5aa4prdy+kWyycdxLde3JFWLrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033