UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pW8CsOmcyRUUacAcnL/QVgctInz8TH+bNkdBhIr8vvg=' 
WHERE 
  key_id = 'abd815c0782904613046e410619592de604dfc2d21a5f7833038d26760d18ae3' 
  AND (
    token = 'pW8CsOmcyRUUacAcnL/QVgctInz8TH+bNkdBhIr8vvg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028