UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ti5+pKl5m0c6XThDO1VjbwOOw4iTuV93gTatq5NfYm0=' 
WHERE 
  key_id = '1e379580eed4fde5c2ec9815509b39101fef76f654c51182b2361b6cf02cece5' 
  AND (
    token = 'ti5+pKl5m0c6XThDO1VjbwOOw4iTuV93gTatq5NfYm0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047