UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mdYYTBY1Dtgybkf5wg8cOCJIwwUSSkYUCJ8hnf+VLJc=' 
WHERE 
  key_id = '4a4d880745d549d8f725312b49973f0498274bf177ce8097eaa9bc5763935937' 
  AND (
    token = 'mdYYTBY1Dtgybkf5wg8cOCJIwwUSSkYUCJ8hnf+VLJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035