UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ftwu6kuOi5yiNguZtlyhX8zq/YTwIOG4aUztkxtd1NE=' 
WHERE 
  key_id = '8d7bb771b381d13f28fb8f5ae60f00e3e3cab645cd78f8e5e56e4d4754880dd5' 
  AND (
    token = 'Ftwu6kuOi5yiNguZtlyhX8zq/YTwIOG4aUztkxtd1NE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039