UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hSn8o1bJgyd6U1eVePtm/8sFILVAr0SD/t0+ZRmP20s=' 
WHERE 
  key_id = 'a1f9000acf43a9be7a25646eb7a117285799559129f629abcb062f04a937c5c4' 
  AND (
    token = 'hSn8o1bJgyd6U1eVePtm/8sFILVAr0SD/t0+ZRmP20s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050