UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UyZP57vGEU9ybC+sGDajtmZCm+7+eEbaexUrm4frTIs=' 
WHERE 
  key_id = '7d5e714001050346cf24828c829997f48e2ba227124564a7af0929379e54e38d' 
  AND (
    token = 'UyZP57vGEU9ybC+sGDajtmZCm+7+eEbaexUrm4frTIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028