UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '86f7TbXt+hAQNFBKYQvVPtdLk2ll1Ae5ZjVeCuoj3Ps=' 
WHERE 
  key_id = '1121bfefec7b407572747ea99edddbd094c36271d0cd72034b9456fc5a190ed5' 
  AND (
    token = '86f7TbXt+hAQNFBKYQvVPtdLk2ll1Ae5ZjVeCuoj3Ps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036