UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A2QttKWim3P2zLniqjxpAoB4bkvDeosCmokdaRNC8+U=' 
WHERE 
  key_id = 'b325b13f6bd3da2824dd74219331a95c8c391247555bb205552e53d4ca37cbf4' 
  AND (
    token = 'A2QttKWim3P2zLniqjxpAoB4bkvDeosCmokdaRNC8+U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052