UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DSmGgjyaVlEw6AiN+LmP9wMTctT4XRuxAmpEYCp185k=' 
WHERE 
  key_id = '833a878be30baa34785250507a6e1b9c5fef4cac882e9b1e8b9c85a122b5374e' 
  AND (
    token = 'DSmGgjyaVlEw6AiN+LmP9wMTctT4XRuxAmpEYCp185k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025