UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QGaOhr3TF9pbAZrA19YLKc6mzqBz9dpL8U3AYuzT0R0=' 
WHERE 
  key_id = '32c1f4763241735a8ee11057c3fc1bcc1b516ba1d5313c2bdb89b60a096bb392' 
  AND (
    token = 'QGaOhr3TF9pbAZrA19YLKc6mzqBz9dpL8U3AYuzT0R0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043