UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CJ+legWXK5rk77kAJRJhsOYSeoCEf4Xqaoek/VCUYGY=' 
WHERE 
  key_id = '8b379fd08877210863fcc92e874ea9e43290f2814b01418d42fd0131812f8713' 
  AND (
    token = 'CJ+legWXK5rk77kAJRJhsOYSeoCEf4Xqaoek/VCUYGY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030