UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VddLLfn5urrwR90SnOQ7kJ24Ppy86zDhThpBAUIICdM=' 
WHERE 
  key_id = '8640a039370c0d01cb87a0e8fc8b36604142a035e4ccd0b29ea99865c85f41c1' 
  AND (
    token = 'VddLLfn5urrwR90SnOQ7kJ24Ppy86zDhThpBAUIICdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049