UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VW62FcuphaL2jFv43RWGKBkuktd/ZScnmodhWMeuv8A=' 
WHERE 
  key_id = '4beb5a895ef7bc45d8e83dd94517eec3996229985b1475245b1fad796271076d' 
  AND (
    token = 'VW62FcuphaL2jFv43RWGKBkuktd/ZScnmodhWMeuv8A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032