UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't2bMuZJgTb0spCmO94YMUfZonq/MdEN6mbuv3o+kGDc=' 
WHERE 
  key_id = '39e6a802cf2c58790d99f21d5a85687a05f2305c31406ee9f50fbbe3e4ca35e7' 
  AND (
    token = 't2bMuZJgTb0spCmO94YMUfZonq/MdEN6mbuv3o+kGDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022