UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bk7QhQ1nS0Huw7ex19j2+IsbH8X+WVCkhKunDVjXXtw=' 
WHERE 
  key_id = 'd715ef239ff5b94c77a1b610f9def59320cfe133b9b113ba6ec30987ac662c5b' 
  AND (
    token = 'bk7QhQ1nS0Huw7ex19j2+IsbH8X+WVCkhKunDVjXXtw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024