UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oHxEW/3UUDp+tMo7FxDRrf6uwKTcxM+jLuOzyEZgltk=' 
WHERE 
  key_id = '645e1e7f525e94d11c1f686dda0a57ee98bd568d565d08649794517e56037341' 
  AND (
    token = 'oHxEW/3UUDp+tMo7FxDRrf6uwKTcxM+jLuOzyEZgltk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047