UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xQTOmyIXeTGGXh5mtRTaSjkE0vxHqL2qzeDKV+Xj4w8=' 
WHERE 
  key_id = 'a9ac3d650d72fb04f6d20c5776054b88d805f820b467698623a115233b3e04a9' 
  AND (
    token = 'xQTOmyIXeTGGXh5mtRTaSjkE0vxHqL2qzeDKV+Xj4w8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022