UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nui2AtjeRxx4BWgzorlWMj04thuOSgbOcKEfql1uT8s=' 
WHERE 
  key_id = 'ddb595d60007d074c46b758659f02882e4122d7ef7a522d9d7b548f51d746238' 
  AND (
    token = 'Nui2AtjeRxx4BWgzorlWMj04thuOSgbOcKEfql1uT8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045