UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r1SuKGTYfS5y7H/oEqkFscNsvT94gCd4/X2vMVbk5Jw=' 
WHERE 
  key_id = 'bd68f7674fa95f5195764adbb01515eef564321caa2dcab5b1433b78c88c2fd7' 
  AND (
    token = 'r1SuKGTYfS5y7H/oEqkFscNsvT94gCd4/X2vMVbk5Jw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028