UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6TIqljscAhZf4r+ieb2E1JBGccXab7LuB3IV3oV6duc=' 
WHERE 
  key_id = 'ac96bc9652fc1634ec9050ee151d508f6b981dcf330295fdba4dd9d789169609' 
  AND (
    token = '6TIqljscAhZf4r+ieb2E1JBGccXab7LuB3IV3oV6duc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042