UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o1+4yM7Hm7M1t7vevajvMAYq86LH3wsK19qXThgsQSg=' 
WHERE 
  key_id = '9d80b66c69d077aff5dee626bc6685bfe16793a80de692af56815ddc8e4c522f' 
  AND (
    token = 'o1+4yM7Hm7M1t7vevajvMAYq86LH3wsK19qXThgsQSg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023