UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+LX0ke8KJ2gX+fsuCmWRbIAbPU/weDladrIUY+LYns=' 
WHERE 
  key_id = 'b1f4b77c6d75ed981c36289d2c542faf510be6ae73d8189f66a188a4b9b7398f' 
  AND (
    token = 'D+LX0ke8KJ2gX+fsuCmWRbIAbPU/weDladrIUY+LYns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018