UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EU0kHWx6sl+aduEc5FNwrLLUA1hAZv2Se6RyAieyHtc=' 
WHERE 
  key_id = '836d6e93075cdad49d64758957688377465d5fde58d7bd9208a30269475c3339' 
  AND (
    token = 'EU0kHWx6sl+aduEc5FNwrLLUA1hAZv2Se6RyAieyHtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044