UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pqw7pz5K39000nSGQVA8J7ygmvxgsviYXtHYnKk4elM=' 
WHERE 
  key_id = '129999aec90d72b75f40ae7fc53050c4af335da1c85a5273206c6c9736c1262e' 
  AND (
    token = 'Pqw7pz5K39000nSGQVA8J7ygmvxgsviYXtHYnKk4elM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034