UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z6ZPw0e54aMzC9UFmxzFiSt4mvW9nhPnKh5xC4Y/+to=' 
WHERE 
  key_id = '882e64a44b084768b090d950705cd60c67882c2fbd6b001580cb0d124e34eacf' 
  AND (
    token = 'z6ZPw0e54aMzC9UFmxzFiSt4mvW9nhPnKh5xC4Y/+to=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00143