UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hCXwOoxU6hBAjCvXoUr5lSSpfgTGD1gLGOpwoBc13Z4=' 
WHERE 
  key_id = 'a0bbe377667c93033e1a0d0a7b283da41d2e8dc7068483410edad0f59860c506' 
  AND (
    token = 'hCXwOoxU6hBAjCvXoUr5lSSpfgTGD1gLGOpwoBc13Z4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033