UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bWrujNef5OQuX92Qcg3vF1DaNCOSUzTTkF6xVTokEGc=' 
WHERE 
  key_id = '7434ead5c0e5e218592f89a49b57868665b1d4b7bc77d67497bd759547c2fe3a' 
  AND (
    token = 'bWrujNef5OQuX92Qcg3vF1DaNCOSUzTTkF6xVTokEGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032