UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wvImDzoeFhzwyTebhqHz1/pgYTAivVJCg1iL8xXv+KM=' 
WHERE 
  key_id = '7bf1273b3647385a759572469f957b8a9c614de647a4c2e07909fb81a2e65a71' 
  AND (
    token = 'wvImDzoeFhzwyTebhqHz1/pgYTAivVJCg1iL8xXv+KM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038