UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JRnnptVWiyYRTMaVXQaRDEmOHsOc8wuXoW4Kh33X43o=' 
WHERE 
  key_id = 'ed8ff9b97c074b905470712b271a838fe85ea0092790520c007665f9c5895295' 
  AND (
    token = 'JRnnptVWiyYRTMaVXQaRDEmOHsOc8wuXoW4Kh33X43o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035