UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HOdmckghg998oKxk0BhjVf55lNIPdr/NjRJKRIYldlM=' 
WHERE 
  key_id = 'a5b544ec783e0031625fe0eee44fe2e15db60f6c514a06724e978393c65f07ae' 
  AND (
    token = 'HOdmckghg998oKxk0BhjVf55lNIPdr/NjRJKRIYldlM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035